#ifndef __singleton__h__
#define __singleton__h__

template <typename T>
class singleton
{
private:
	static T* me;

public:
	static T* get_instance();
	static void destroy();

};

template <typename T>
T* singleton<T>::me = 0;

template <typename T>
T* singleton<T>::get_instance()
{
	if (me == 0)
	{
		me = new T();
	}
	return me;
}

template <typename T>
void singleton<T>::destroy()
{
	if (me != 0)
	{
		delete me;
		me = 0;
	}
}

#endif